﻿using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        GSM[] somePhones = new GSM[]
        {
            new GSM("N345", "Nokia", 300, "Chicho Gosho"),
            new GSM("Experia", "Sony", 400, "Aunt Marla"),
            GSM.IPhone4S,
        };
        foreach (GSM phone in somePhones)
        {
            phone.DisplayInfo();
        }
        GSM someCalls = new GSM("Galaxy", "Samsung");
        someCalls.AddCall(new Call(new DateTime(2013, 03, 09, 20, 17, 30), "0888000888", 180));
    }
    
}
public class Battery
{
    private string model;
    private double hoursIdle;
    private double hoursTalk;
    private BatteryType type;

    public Battery(string model)
        : this(model, 0, 0, BatteryType.undefined)
    { }
    public Battery(string model, double hoursIdle)
        : this(model, hoursIdle, 0, BatteryType.undefined)
    { }
    public Battery(string model, double hoursIdle, double hoursTalk)
        : this(model, hoursIdle, hoursTalk, BatteryType.undefined)
    { }
    public Battery(string model, double hoursIdle, double hoursTalk, BatteryType type)
    {
        this.model = model;
        this.hoursIdle = hoursIdle;
        this.hoursTalk = hoursTalk;
        this.type = type;
    }
    public string Model
    {
        get { return model; }
        set { model = value; }
    }
    public double HoursIdle
    {
        get { return hoursIdle; }
        set { hoursIdle = value; }
    }
    public double HoursTalk
    {
        get { return hoursTalk; }
        set { hoursTalk = value; }
    }
}
public class Display
{
    private int width;
    private int height;
    private int colors;

    public Display()
    { }
    public Display(int width)
    {
        this.width = width;
    }
    public Display(int width, int height)
    {
        this.width = width;
        this.height = height;
    }
    public Display(int width, int height, int colors)
    {
        this.width = width;
        this.height = height;
        this.colors = colors;
    }
    public int Width
    {
        get { return width; }
        set { width = value; }
    }
    public int Height
    {
        get { return height; }
        set { height = value; }
    }
    public int Colors
    {
        get { return colors; }
        set { colors = value; }
    }
}
public class GSM
{
    private string model;
    private string manufacturer;
    private decimal price;
    private string owner;
    private Battery battery;
    private Display display;
    static private GSM iPhone4S = new GSM("4S", "Apple", 1000);
    private List<Call> callHistory;

    public GSM(string model, string manufacturer)
        : this(model, manufacturer, 0, null, new Battery(null), new Display())
    { }
    public GSM(string model, string manufacturer, decimal price)
        : this(model, manufacturer, price, null, new Battery(null), new Display())
    { }
    public GSM(string model, string manufacturer, decimal price, string owner)
        : this(model, manufacturer, price, owner,new Battery(null), new Display())
    { }
    public GSM(string model, string manufacturer, decimal price, string owner, Battery battery) 
        : this(model, manufacturer, price, owner, battery, new Display())
    { }
    public GSM(string model, string manufacturer, decimal price, string owner, Battery battery, Display display)
    {
        this.model = model;
        this.manufacturer = manufacturer;
        this.price = price;
        this.owner = owner;
        this.battery = battery;
        this.display = display;
    }

    public string Model
    {
        get { return model; }
        set { model = value; }
    }
    public string Manufacturer
    {
        get { return manufacturer; }
        set { manufacturer = value; }
    }
    public decimal Price
    {
        get { return price; }
        set { price = value; }
    }
    public string Owner
    {
        get { return owner; }
        set { owner = value; }
    }
    public Battery Battery
    {
        get { return battery; }
        set { battery = value; }
    }
    public Display Display
    {
        get { return display; }
        set { display = value; }
    }
    public static GSM IPhone4S
    {
        get { return iPhone4S; }
    }
    public List<Call> CallHistory
    {
        get { return callHistory; }
        set { callHistory = value; }
    }
    

    public void DisplayInfo()
    {
        Console.WriteLine("The model of the GSM is {0}.",model);
        Console.WriteLine("The manufacturer of the GSM is {0}.", manufacturer);
        Console.WriteLine("The price of the GSM is {0}.", price);
        Console.WriteLine("The owner of the GSM is {0}.", owner);
        Console.WriteLine("The model of the battery is {0}.", battery.Model);
        Console.WriteLine("The battery hours idle time is {0}.", battery.HoursIdle);
        Console.WriteLine("The battery hours talk time is {0}.", battery.HoursTalk);
        Console.WriteLine("The display size is {0} by {1} pixels.", display.Width, display.Height);
        Console.WriteLine("The display handles {0} colors.", display.Colors);
    }
    public void AddCall(Call call)
    {
        callHistory.Add(call);
    }
    public void RemoveCall(Call call)
    {
        callHistory.Remove(call);
    }
    public void ClearAll()
    {
        callHistory.RemoveRange(0, callHistory.Count);
    }
    static decimal TotalPrice(List<Call> call, decimal pricePerMinute)
    {
        decimal sum = 0;
        decimal totalPrice = 0;
        for (int i = 0; i < call.Count; i++)
        {
            sum += call[i].Duration;
        }
        totalPrice = (sum / 60) * pricePerMinute;
        return totalPrice;
    }
}
public class Call
{
    private DateTime dateTime;
    private string numberDialed;
    private int durationSeconds;
    

    public Call(DateTime dateTime, string numberDialed)
        : this(dateTime, numberDialed, 0)
    { }
    public Call(DateTime dateTime, string numberDialed, int duration)
    {
        this.dateTime = dateTime;
        this.numberDialed = numberDialed;
        this.durationSeconds = duration;
    }

    public DateTime DateTime
    {
        get { return dateTime; }
        set { dateTime = value; }
    }
    public string NumberDialed
    {
        get { return numberDialed; }
        set { numberDialed = value; }
    }
    public int Duration
    {
        get { return durationSeconds; }
        set { durationSeconds = value; }
    }
}
public enum BatteryType
{ 
    LiIon, NiMH, NiCd, LeadAcid, undefined
}
